/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.portlet.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.portlet.model.nlhassp;
import com.portlet.model.nlhasspModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the nlhassp service. Represents a row in the &quot;congty_nlhassp&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.portlet.model.nlhasspModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link nlhasspImpl}.
 * </p>
 *
 * @author Thi
 * @see nlhasspImpl
 * @see com.portlet.model.nlhassp
 * @see com.portlet.model.nlhasspModel
 * @generated
 */
public class nlhasspModelImpl extends BaseModelImpl<nlhassp>
	implements nlhasspModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a nlhassp model instance should use the {@link com.portlet.model.nlhassp} interface instead.
	 */
	public static final String TABLE_NAME = "congty_nlhassp";
	public static final Object[][] TABLE_COLUMNS = {
			{ "maNLSP", Types.BIGINT },
			{ "maNguyenLieu", Types.VARCHAR },
			{ "maQC", Types.VARCHAR },
			{ "quyCach", Types.VARCHAR },
			{ "tieuChiKiemTra", Types.VARCHAR },
			{ "cachKiemTra", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table congty_nlhassp (maNLSP LONG not null primary key,maNguyenLieu VARCHAR(75) null,maQC VARCHAR(75) null,quyCach VARCHAR(75) null,tieuChiKiemTra VARCHAR(75) null,cachKiemTra VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table congty_nlhassp";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.portlet.model.nlhassp"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.portlet.model.nlhassp"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.portlet.model.nlhassp"));

	public nlhasspModelImpl() {
	}

	public long getPrimaryKey() {
		return _maNLSP;
	}

	public void setPrimaryKey(long primaryKey) {
		setMaNLSP(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_maNLSP);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return nlhassp.class;
	}

	public String getModelClassName() {
		return nlhassp.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("maNLSP", getMaNLSP());
		attributes.put("maNguyenLieu", getMaNguyenLieu());
		attributes.put("maQC", getMaQC());
		attributes.put("quyCach", getQuyCach());
		attributes.put("tieuChiKiemTra", getTieuChiKiemTra());
		attributes.put("cachKiemTra", getCachKiemTra());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long maNLSP = (Long)attributes.get("maNLSP");

		if (maNLSP != null) {
			setMaNLSP(maNLSP);
		}

		String maNguyenLieu = (String)attributes.get("maNguyenLieu");

		if (maNguyenLieu != null) {
			setMaNguyenLieu(maNguyenLieu);
		}

		String maQC = (String)attributes.get("maQC");

		if (maQC != null) {
			setMaQC(maQC);
		}

		String quyCach = (String)attributes.get("quyCach");

		if (quyCach != null) {
			setQuyCach(quyCach);
		}

		String tieuChiKiemTra = (String)attributes.get("tieuChiKiemTra");

		if (tieuChiKiemTra != null) {
			setTieuChiKiemTra(tieuChiKiemTra);
		}

		String cachKiemTra = (String)attributes.get("cachKiemTra");

		if (cachKiemTra != null) {
			setCachKiemTra(cachKiemTra);
		}
	}

	public long getMaNLSP() {
		return _maNLSP;
	}

	public void setMaNLSP(long maNLSP) {
		_maNLSP = maNLSP;
	}

	public String getMaNguyenLieu() {
		if (_maNguyenLieu == null) {
			return StringPool.BLANK;
		}
		else {
			return _maNguyenLieu;
		}
	}

	public void setMaNguyenLieu(String maNguyenLieu) {
		_maNguyenLieu = maNguyenLieu;
	}

	public String getMaQC() {
		if (_maQC == null) {
			return StringPool.BLANK;
		}
		else {
			return _maQC;
		}
	}

	public void setMaQC(String maQC) {
		_maQC = maQC;
	}

	public String getQuyCach() {
		if (_quyCach == null) {
			return StringPool.BLANK;
		}
		else {
			return _quyCach;
		}
	}

	public void setQuyCach(String quyCach) {
		_quyCach = quyCach;
	}

	public String getTieuChiKiemTra() {
		if (_tieuChiKiemTra == null) {
			return StringPool.BLANK;
		}
		else {
			return _tieuChiKiemTra;
		}
	}

	public void setTieuChiKiemTra(String tieuChiKiemTra) {
		_tieuChiKiemTra = tieuChiKiemTra;
	}

	public String getCachKiemTra() {
		if (_cachKiemTra == null) {
			return StringPool.BLANK;
		}
		else {
			return _cachKiemTra;
		}
	}

	public void setCachKiemTra(String cachKiemTra) {
		_cachKiemTra = cachKiemTra;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			nlhassp.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public nlhassp toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (nlhassp)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	public nlhassp toUnescapedModel() {
		return (nlhassp)this;
	}

	@Override
	public Object clone() {
		nlhasspImpl nlhasspImpl = new nlhasspImpl();

		nlhasspImpl.setMaNLSP(getMaNLSP());
		nlhasspImpl.setMaNguyenLieu(getMaNguyenLieu());
		nlhasspImpl.setMaQC(getMaQC());
		nlhasspImpl.setQuyCach(getQuyCach());
		nlhasspImpl.setTieuChiKiemTra(getTieuChiKiemTra());
		nlhasspImpl.setCachKiemTra(getCachKiemTra());

		nlhasspImpl.resetOriginalValues();

		return nlhasspImpl;
	}

	public int compareTo(nlhassp nlhassp) {
		long primaryKey = nlhassp.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof nlhassp)) {
			return false;
		}

		nlhassp nlhassp = (nlhassp)obj;

		long primaryKey = nlhassp.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<nlhassp> toCacheModel() {
		nlhasspCacheModel nlhasspCacheModel = new nlhasspCacheModel();

		nlhasspCacheModel.maNLSP = getMaNLSP();

		nlhasspCacheModel.maNguyenLieu = getMaNguyenLieu();

		String maNguyenLieu = nlhasspCacheModel.maNguyenLieu;

		if ((maNguyenLieu != null) && (maNguyenLieu.length() == 0)) {
			nlhasspCacheModel.maNguyenLieu = null;
		}

		nlhasspCacheModel.maQC = getMaQC();

		String maQC = nlhasspCacheModel.maQC;

		if ((maQC != null) && (maQC.length() == 0)) {
			nlhasspCacheModel.maQC = null;
		}

		nlhasspCacheModel.quyCach = getQuyCach();

		String quyCach = nlhasspCacheModel.quyCach;

		if ((quyCach != null) && (quyCach.length() == 0)) {
			nlhasspCacheModel.quyCach = null;
		}

		nlhasspCacheModel.tieuChiKiemTra = getTieuChiKiemTra();

		String tieuChiKiemTra = nlhasspCacheModel.tieuChiKiemTra;

		if ((tieuChiKiemTra != null) && (tieuChiKiemTra.length() == 0)) {
			nlhasspCacheModel.tieuChiKiemTra = null;
		}

		nlhasspCacheModel.cachKiemTra = getCachKiemTra();

		String cachKiemTra = nlhasspCacheModel.cachKiemTra;

		if ((cachKiemTra != null) && (cachKiemTra.length() == 0)) {
			nlhasspCacheModel.cachKiemTra = null;
		}

		return nlhasspCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(13);

		sb.append("{maNLSP=");
		sb.append(getMaNLSP());
		sb.append(", maNguyenLieu=");
		sb.append(getMaNguyenLieu());
		sb.append(", maQC=");
		sb.append(getMaQC());
		sb.append(", quyCach=");
		sb.append(getQuyCach());
		sb.append(", tieuChiKiemTra=");
		sb.append(getTieuChiKiemTra());
		sb.append(", cachKiemTra=");
		sb.append(getCachKiemTra());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(22);

		sb.append("<model><model-name>");
		sb.append("com.portlet.model.nlhassp");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>maNLSP</column-name><column-value><![CDATA[");
		sb.append(getMaNLSP());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>maNguyenLieu</column-name><column-value><![CDATA[");
		sb.append(getMaNguyenLieu());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>maQC</column-name><column-value><![CDATA[");
		sb.append(getMaQC());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>quyCach</column-name><column-value><![CDATA[");
		sb.append(getQuyCach());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>tieuChiKiemTra</column-name><column-value><![CDATA[");
		sb.append(getTieuChiKiemTra());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>cachKiemTra</column-name><column-value><![CDATA[");
		sb.append(getCachKiemTra());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = nlhassp.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			nlhassp.class
		};
	private long _maNLSP;
	private String _maNguyenLieu;
	private String _maQC;
	private String _quyCach;
	private String _tieuChiKiemTra;
	private String _cachKiemTra;
	private nlhassp _escapedModel;
}